﻿<%@ Page Language="C#" AutoEventWireup="true"  ValidateRequest="false" CodeBehind="AdContent.aspx.cs" Inherits="NJL.WebManage.Ad.AdContent" %>

<%@ Import Namespace="Royalsoft.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        function check() {
        
            var txtName = document.getElementById("<%=txtName.ClientID %>").value;
            if ($.trim(txtName) == "") {
                alert("请输入名称");
                return false;
            }
            var txtStartTime = document.getElementById("<%=txtStartTime.ClientID %>").value;
            if ($.trim(txtStartTime) == "") {
                alert("请输入开始时间");
                return false;
            }
            var txtendTime = document.getElementById("<%=txtendTime.ClientID %>").value;
            if ($.trim(txtendTime) == "") {
                alert("请输入结束时间");
                return false;
            }
            //地区选择
            var selectArea = document.getElementById("<%=ddlProvince.ClientID %>");
            if (selectArea != null) {
                if (selectArea.value == "000000") {
                    alert("请选择地区");
                    return false;
                }
            }

        }
    </script>
    <style type="text/css">
        ul
        {
            list-style-type: none;
            margin: 0;
            width: 100%;
        }
        ul li
        {
            width: 150px;
            float: left;
        }
    </style>
    <script type="text/javascript">
        function textboxSelect() {
            var checkbox = document.getElementsByName("cbxSingle");
            for (var i = 0; i < checkbox.length; i++) {
                checkbox[i].checked = !checkbox[i].checked;
            }
        }
        function checkCheckboxState() {
            var checkbox = document.getElementsByName("cbxSingle");
            var hiddenId = "";
            var count = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked == true) {
                    hiddenId += checkbox[i].value + ",";
                    count++;
                }
            }
            if (count == 0) {
                alert('请选择您要删除的记录')
                return false;
            }
            else {
                if (window.confirm("您确定要删除该记录？")) {
                    hiddenId = hiddenId.substring(0, hiddenId.length - 1);
                    document.getElementById("<%=HSelectId.ClientID %>").value = hiddenId;
                }
                else {
                    return false;
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="main_content fr">
        <div class="gray_bd">
            <div class="table_title">
                广告内容管理</div>
            <div class="pad5px">
                <div class="border_b_dotted">
                    <table class="tableliststyle" cellspacing="0" rules="all" border="1">
                        <tr class="gridheader">
                            <th style="width: 5%">
                                <input id="cbxAll" type="checkbox" onclick="textboxSelect()" />
                            </th>
                            <th style="width: 5%">
                                序号
                            </th>
                            <th style="width: 10%">
                                名称
                            </th>
                            <th style="width: 15%">
                                广告开始时间
                            </th>
                            <th style="width: 15%">
                                广告结束时间
                            </th>
                            <th style="width: 13%">
                                添加时间
                            </th>
   
                            <th style="width: 5%;">
                                编辑
                            </th>
                            <th style="width: 5%;">
                                删除
                            </th>
                        </tr>
                        <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand"
                            OnItemDataBound="rptUserList_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <input id="<%#Eval("ID") %>" type="checkbox" value="<%#Eval("ID") %>" name="cbxSingle" />
                                    </td>
                                    <td align="center">
                                        <asp:Literal ID="litNum" runat="server"></asp:Literal>
                                    </td>
                                    <td align="left" title="<%#Eval("AD_NAME") %>">
                                        <%#PageValidate.InputText(Eval("AD_NAME").ToString(), 20)%>
                                    </td>
                                    <td align="center" title="<%#Eval("AD_START_DATE_TIME") %>">
                                        <%#Eval("AD_START_DATE_TIME", "{0:yyyy-MM-dd HH:mm:ss}")%>
                                    </td>
                                    <td align="center">
                                       <%#Eval("AD_END_DATE_TIME", "{0:yyyy-MM-dd HH:mm:ss}")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("CREATE_DATE_TIME", "{0:yyyy-MM-dd HH:mm:ss}")%>
                                    </td>
           
                                    <td align="center">
                                        <asp:LinkButton ID="linkbtnEdit" runat="server" CommandName="edit" CommandArgument='<%#Eval("ID") %>'>编辑</asp:LinkButton>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbtnDel" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
                                            OnClientClick="return confirm('您确定要删除该信息吗？')">删除</asp:LinkButton>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div style="text-align: left; margin-top: 5px;">
                        <asp:Button ID="btnDel" runat="server" Text="删除" OnClientClick="return checkCheckboxState()"
                            OnClick="btnDel_Click1" />
                    </div>
                </div>
                <div style="text-align: center">
                    共
                    <asp:Literal ID="lit" runat="server"></asp:Literal>
                    条记录&nbsp;&nbsp;&nbsp;&nbsp; 共
                    <asp:Literal ID="litAllPage" runat="server"></asp:Literal>
                    页&nbsp;&nbsp;&nbsp;&nbsp; 第
                    <asp:Literal ID="litCurrentPage" runat="server"></asp:Literal>
                    页
                    <asp:LinkButton ID="lbtnFirst" runat="server" OnClick="lbtnFirst_Click">首页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnPrev" runat="server" OnClick="lbtnPrev_Click">上一页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnNext" runat="server" OnClick="lbtnNext_Click">下一页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnEnd" runat="server" OnClick="lbtnEnd_Click">末页</asp:LinkButton>
                    跳转到第
                    <asp:TextBox ID="txtPage" runat="server" Width="32px" MaxLength="8" Style="text-align: center"></asp:TextBox>&nbsp;页&nbsp;
                    <asp:Button ID="btnRir" runat="server" Text="确定" OnClick="btnRir_Click" />
                </div>
            </div>
        </div>
    </div>
    <div class="table_title">
        添加广告</div>
    <div>
        <table align="center" cellspacing="0" style="width: 100%">
            <tr>
                <td style="width: 120px; text-align: right;">
                    广告名称：
                </td>
                <td>
                    <asp:TextBox ID="txtName" runat="server" Width="400px" MaxLength="50"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 120px; text-align: right;">
                    广告开始时间：
                </td>
                <td>
                    <asp:TextBox ID="txtStartTime" runat="server" Width="200px" MaxLength="50" onClick="WdatePicker()"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 120px; text-align: right;">
                    广告结束时间：
                </td>
                <td>
                    <asp:TextBox ID="txtendTime" runat="server" Width="200px" MaxLength="50" onClick="WdatePicker()"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr id="disProvice">
                <td style="width: 120px; text-align: right;">
                    发布站点：
                </td>
                <td>
                    <asp:DropDownList ID="ddlProvince" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 120px; text-align: right;">
                    广告内容：
                </td>
                <td>
                    <asp:TextBox ID="txtAdContent" runat="server" Width="400px" Height="80px" TextMode="MultiLine"></asp:TextBox>
                    <script type="text/javascript">
                        CKEDITOR.replace('<%=txtAdContent.ClientID%>',
                            {
                                filebrowserBrowseUrl: '/ckfinder/ckfinder.html', //启用浏览功能
                                filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html?Type=Images',
                                filebrowserFlashBrowseUrl: '/ckfinder/ckfinder.html?Type=Flash',
                                filebrowserUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
                                filebrowserImageUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
                                filebrowserFlashUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
                            }
                            );
                    </script>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Style="height: 21px"
                        Text="提交" Width="40px" OnClientClick="return check()" />
                    &nbsp;<input id="btnBack" runat="server"  type="button" value="返回"
                        onclick="window.location.href='AdManage.aspx'" />
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="HSelectId" runat="server" />
    </form>
</body>
</html>
